#ifndef _FIG_UI_LEVELCOMPLETE_H_
#define _FIG_UI_LEVELCOMPLETE_H_

#include "fig_gamecenter.h"
#include "fig_ui_popupmanager.h"

//#include "fbcplus/fbconnectcplus.h"    // deprecated by me
#include "gameflow/ui_popup.h"


class GENGameState;

class FIGUILevelComplete : public FIGUIPopupAnimator
{
	
public:

	const static int				INFO_WIDGET_COUNT = 4;
		
	FIGUILevelComplete(const std::string& File);

	virtual void					Show();
	virtual void					Tick(float dt);

	//virtual void					OnFBShareSucess();
	//virtual void					OnFBShareFail();	
	//virtual void					ForceHide();
	

protected:

	void DELEGATE_CALL				OnClickScreen(ui::UIWidget::WIDGET_EVENT Event, ui::UIWidget* pWidget);
	
	void DELEGATE_CALL				OnClickMedal(ui::UIWidget::WIDGET_EVENT Event, ui::UIWidget* pWidget);	
	void DELEGATE_CALL				OnClosePopupMedal(ui::UIWidget::WIDGET_EVENT Event, ui::UIWidget* pWidget);	
	//void DELEGATE_CALL				OnButtonShare(ui::UIWidget::WIDGET_EVENT Event, ui::UIWidget* pWidget);

	void DELEGATE_CALL				OnButtonRateUs(ui::UIWidget::WIDGET_EVENT Event, ui::UIWidget* pWidget);
	void DELEGATE_CALL				OnButtonCancel(ui::UIWidget::WIDGET_EVENT Event, ui::UIWidget* pWidget);
	void DELEGATE_CALL				OnButtonFullVersion(ui::UIWidget::WIDGET_EVENT Event, ui::UIWidget* pWidget);
	//void DELEGATE_CALL				OnButtonAndroidRateUs(ui::UIWidget::WIDGET_EVENT Event, ui::UIWidget* pWidget);
	void DELEGATE_CALL				OnButtonAndroids(ui::UIWidget::WIDGET_EVENT Event, ui::UIWidget* pWidget);
	


	void							RefreshUI();
	void							InitWidgetNumber(ui::UIWidget* pWidget);
	void							GoToNextLevel();
	
	
	int								m_pUIInfos[INFO_WIDGET_COUNT];
	bool							m_IsReady;


	ui::UIWidget*					m_pUIScore1;
	ui::UIWidget*					m_pUIScore2;
	ui::UIWidget*					m_pUIScore3;
	ui::UIWidget*					m_pUIScore4;

	ui::UIWidget*					m_pUIBonus1;
	ui::UIWidget*					m_pUIBonus2;
	
	ui::UIWidget*					m_pUIMedals[FIGGameCenter::ACHIEVEMENT_C];
	ui::UIWidget*					m_pUIIsNew[FIGGameCenter::ACHIEVEMENT_C];

	math::Counter					m_BonusCounter;
	math::Counter					m_ScoreCounter;


	int								m_BonusScore1;
	int								m_BonusScore2;
	

	int								m_BaseScore;
	int								m_TotalScore;
	int								m_CarryScore;

	
	math::Counter					m_AlphaCounter;
	ui::UIWidget*					m_pUIInfoTxtBg;
	ui::UIWidget*					m_pUIInfoTxt;


	float							m_PopupReshowCounter;
	bool							m_ToCloseMedalInfoPopup;
	bool							m_IsAlreadyOnClickScreen;
    math::Vec2                      m_ButtonNextPosBackup;
	

private:

	void							LoadMedals();

};


#endif //_PVI_UI_WRAPPER_H_